import Vue from "vue";
import VueRouter from "vue-router";
Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    redirect: "/DimensionManagement",
  },
  {
    path: "/DimensionManagement",
    name: "dimensionManagement",
    meta: {
      title: "维度管理",
    },
    component: () => import("@/views/DimensionManagement/dimensionManagement"),
  },
  {
    path: "/DimensionValueManagement",
    name: "dimensionValueManagement",
    meta: {
      title: "维值管理",
    },
    component: () =>
      import("@/views/DimensionValueManagement/dimensionValueManagement"),
  },
  {
    path: "/BasicIndexManagement",
    name: "basicIndexManagement",
    meta: {
      title: "基础指标管理",
    },
    component: () =>
      import("@/views/BasicIndexManagement/basicIndexManagement"),
  },
  {
    path: "/IndexManagement",
    name: "indexManagement",
    meta: {
      title: "指标管理",
    },
    component: () => import("@/views/IndexManagement/indexManagement"),
  },
  {
    path: "/UserManage",
    name: "userManage",
    meta: {
      title: "用户管理",
    },
    component: () => import("@/views/UserManage/userManage"),
  },
  {
    path: "/RoleManage",
    name: "roleManage",
    meta: {
      title: "角色管理",
    },
    component: () => import("@/views/RoleMange/roleManage"),
  },
  {
    path: "/UserDetail",
    name: "userDetail",
    meta: {
      title: "用户明细",
    },
    component: () => import("@/views/UserDetail/userDetail"),
  },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});
router.beforeEach((to, from, next) => {
  document.title = to.meta.title;
  next();
});
export default router;
